package com.ruoyi.web.controller.hydrology;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.hydrology.domain.CgkcdssHistory;
import com.ruoyi.hydrology.dto.HydrologyDto;
import com.ruoyi.hydrology.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;


@RestController
@RequestMapping("/control/hydrology")
public class HydrologyContriller extends BaseController {
    @Autowired
    private ICgkcddyService cgkcddyService;
    @Autowired
    private IJslcddyService jslcddyService;
    @Autowired
    private IPslcddyService pslcddyService;
    @Autowired
    private IYslcddyService yslcddyService;
    /**
     * 查询长观孔历史数据列表
     */
    @PreAuthorize("@ss.hasPermi('control:cgkHistory:list')")
    @GetMapping("/list")
    public TableDataInfo list()
    {
        List<HydrologyDto> list = new ArrayList<>();
        List<HydrologyDto> cgk = cgkcddyService.getHydrology();
        if (cgk.size() > 0){
            for (HydrologyDto hydrologyDto : cgk) {
                list.add(hydrologyDto);            }
        }
        List<HydrologyDto> jsl = jslcddyService.getHydrology();
        if (jsl.size() > 0){
            for (HydrologyDto hydrologyDto : jsl) {
                list.add(hydrologyDto);            }
        }
        List<HydrologyDto> psl = pslcddyService.getHydrology();
        if (psl.size() > 0){
            for (HydrologyDto hydrologyDto : psl) {
                list.add(hydrologyDto);            }
        }
        List<HydrologyDto> ysl = yslcddyService.getHydrology();
        if (ysl.size() > 0){
            for (HydrologyDto hydrologyDto : ysl) {
                list.add(hydrologyDto);            }
        }
        return getDataTable(list);
    }
}
